package com.yz.vi.commons.enums;

import com.yz.vi.commons.base.enums.MSEnum;

/**
 * 异常编码定义
 *
 * @author maoliang
 * @date 2020-08-13
 */
public interface ErrorCodeEnum extends MSEnum {

    /**
     * 错误码格式 统一格式：A-BB-CCC
     * A  :错误原因 S-系统 U-客户 C-依赖接口
     * BB :服务代码 01-积分服务
     * CCC:错误编号, 自增
     */

    enum S implements ErrorCodeEnum {
        //
        SYSTEM_EXCEPTION("S01001", "系统异常"),
        INVALID_UPDATE("S01002", "无效数据更新"),
        INVALID_ACTIV_STATUS("S01003", "活动状态不在进行中"),
        SYSTEM_DATA_EXCEPTION("S01004", "系统数据异常");

        S(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        private String code;
        private String msg;

        @Override
        public String getCode() {
            return this.code;
        }

        @Override
        public String getMsg() {
            return this.msg;
        }
    }

    enum U implements ErrorCodeEnum {
        //
        EMPTY_PARAM("U01001", "参数不能为空"),
        ILLEGAL_PARAM("U01002", "非法参数值"),
        INVALID_BIZ_DATA("U01003", "业务数据校验失败"),
        DATA_NOT_EXISTS("U01004", "数据不存在"),
        ACCESS_DENIED("U01005", "客户无权限"),
        DUPLICATE("U01006", "重复操作"),
        NO_CUST_INFO("U01007", "未获取客户信息"),
        NOT_LOANMANAGE("U01008", "没有管护客户经理"),
        NOT_BRANCH("U01009", "未获取到分支信息");

        U(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        private String code;
        private String msg;

        @Override
        public String getCode() {
            return this.code;
        }

        @Override
        public String getMsg() {
            return this.msg;
        }
    }

    enum C implements ErrorCodeEnum {
        //
        CALL_EXCEPTION("C01001", "请求外部服务异常"),
        RESULT_INVALID("C01002", "外部服务返回结果与预期不符");

        C(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        private String code;
        private String msg;

        @Override
        public String getCode() {
            return this.code;
        }

        @Override
        public String getMsg() {
            return this.msg;
        }
    }


}
